package lhc.alg.top100;

/**
 * description: https://leetcode.cn/problems/find-peak-element/
 *
 * 特殊的二分法  爬坡法 我擦 爬坡  腿软了。。。
 *
 * author: hongchen.liao
 * date:  2022/8/2
 */
public class _162_Find_Peak_Element {

    class Solution {
        public int findPeakElement(int[] nums) {
            int n = nums.length;
            int l = 0, r = n-1;
            while(l < r){
                int mid = (l + r) >>> 1;
                if(nums[mid] < nums[mid+1]){
                    l = mid+1;
                }else{
                    r = mid;
                }
            }
            return l;
        }
    }

}
